package com.zw.mes.module.prodtaskmanager.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.module.prodtaskmanager.model.ProdOrdModel;
import com.zw.mes.module.prodtaskmanager.service.ProdChangeFlagService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 项目串料标识维护控制层
 * @author XYH
 */
@Controller
@RequestMapping("/proChangeFlag")
public class ProdChangeFlagController extends BaseController {

    @Autowired
    private ProdChangeFlagService service;

    /**
     * 跳转到项目串料标识维护页面
     * @return
     */
    @GetMapping
    @RequiresPermissions("pro:changeflag:view")
    public String page(){
        return "prodTaskManager/proChangeFlag/page";
    }

    /**
     * 加载项目串料标识维护页面列表
     * @param param
     * @return
     */
    @ResponseBody
    @PostMapping("/prodList")
    @RequiresPermissions("pro:changeflag:view")
    public JsonResult prodList(ProdOrdModel param){
        startPage();
        return jsonResult(service.prodList(param));
    }
    /**
     * 保存编辑
     * @param param
     * @return
     */
    @ResponseBody
    @PostMapping("/save")
    @RequiresPermissions("pro:changeflag:edit")
    public JsonResult save(ProdOrdModel param){
        return service.save(param);
    }
}
